<?php
class worksCategory extends CWidget
{
	public $htmlOptions = array();

	public $length = 30;
	
	public $limit = 3;
	
	public $id = 'recentWorks';
	
	public $dataProvider;
	
	public function getData()
	{
		
		$model = Category::model()->find(array(
			'condition'=>'cate_type = :cate_type AND cate_pid = :cate_pid',
			'order'=>'cate_id DESC',
			'limit'=>$this->limit,
			'params'=>array(
				':cate_type' => Category::CATEGORY_MEDIA,
				':cate_pid' => 0,
			)
		));
		
		$this->dataProvider = $model->children;
		

	}
	
	
	public function run()
	{	
		$this->getData();
		
// 		UtilTools::dump($this->dataProvider);
		
// 		Yii::app()->end();
		
		$this->render('category',array(
			'dataProvider' => $this->dataProvider
		));
	}
}
?>